/*
 * 작성일 : 2014. 4. 10.
 * 작성자 : hch1982
 *
 * 설명
*/ 
/**
 * 
 */
package springbook.temp;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

/**
 * @author hch1982
 *
 * 코드 수정 히스토리
 * 날짜		작업자		태그
 * 2014. 4. 10.	hch1982	
 */
public class HelloController implements Controller{
	@Autowired HelloSpring helloSpring;

	/* (non-Javadoc)
	 * @see org.springframework.web.servlet.mvc.Controller#handleRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
	 */
	@Override
	public ModelAndView handleRequest(HttpServletRequest req,
			HttpServletResponse res) throws Exception {
		// TODO Auto-generated method stub
		String name = req.getParameter("name");
		
		String message = this.helloSpring.sayHello(name);
		
		Map<String, Object> model = new HashMap<String, Object>();
		
		model.put("message", message);
		
		return new ModelAndView("/WEB-INF/view/hello.jsp", model);
	}
	
	
}
